package com.example.demo.collection.hashcode;

import com.example.demo.collection.hashcode.model.Point;

import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;

/**
 * @author luowj12
 * @since 2021/6/9 9:58
 */
public class HashCodeTest {
    public static void main(String[] args) {
        Collection set = new HashSet();
        Point p1 = new Point(1, 1);
        Point p2 = new Point(1, 1);

        System.out.println(p1.equals(p2));
        set.add(p1);   //(1)
        set.add(p2);   //(2)
        set.add(p1);   //(3)

        Iterator iterator = set.iterator();
        while (iterator.hasNext()) {
            Object object = iterator.next();
            System.out.println(object);
        }
        "bb".hashCode();
    }
}
